package net.ib.mtalk.receiver;

import net.ib.mtalk.global.GlobalPreferences;
import net.ib.mtalk.service.SelecterService;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * A BroadcastReciever Class that Receives the Boot complete broadcast event.
 * @author	urunimi@infobank.net, Arngard
 */
public class PoweronReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		//MTalkLogWriter.v("PoweronReceiver.onReceive() - start");
		if (intent.getAction() == null) {
			//MTalkLogWriter.v("PoweronReceiver.onReceive() - end");
			return;
		}

		if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
			if (GlobalPreferences.getRegistrationId() == null) {
				SelecterService.actionStart(context);//LocalService.actionStart(context);
			} else {
				//MTalkLogWriter.d("ServiceRestartSignReceiver.onReceive(): There's C2DM RegistrationId.");
			}
		}
		
		//MTalkLogWriter.v("PoweronReceiver.onReceive() - end");
	}
}
